﻿using MCPlatform.MotionLib.Base.AssitantClass;
using Panuon.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MCPlatform.Models
{
    public class ProductModel: NotifyPropertyChangedBase,INameProvider
    {
        /// <summary>
        /// 产品名称
        /// </summary>
        public string ControlName
        {
            get => _ControlName;
            set
            {
                Set(ref _ControlName, value);

            }
        }

        private string _ControlName = string.Empty;


        /// <summary>
        /// 产品厚度
        /// </summary>
        public double Thickness
        {
            get => _Thickness;
            set
            {
               
                Set(ref _Thickness, value);

            }
        }

        private double _Thickness = 0.5;




        /// <summary>
        /// 裁切宽度
        /// </summary>
        public double CuttingWidth
        {
            get => _CuttingWidth;
            set
            {
                Set(ref _CuttingWidth, value);

            }
        }

        private double _CuttingWidth;


        /// <summary>
        /// 裁切长度
        /// </summary>
        public double CuttingLength
        {
            get => _CuttingLength;
            set
            {
                Set(ref _CuttingLength, value);

            }
        }

        private double _CuttingLength;


        /// <summary>
        /// 裁切间距
        /// </summary>
        public double Space
        {
            get => _Space;
            set
            {
                Set(ref _Space, value);

            }
        }
        private double _Space;


        /// <summary>
        /// 图案间距
        /// </summary>
        public double PatternSpace
        {
            get => _PatternSpace;
            set
            {
                Set(ref _PatternSpace, value);

            }
        }
        private double _PatternSpace;


        /// <summary>
        /// 是否打孔
        /// </summary>
        public bool IsPunch
        {
            get => _IsPunch;
            set
            {
                Set(ref _IsPunch, value);
            }
        }
        private bool _IsPunch;


        /// <summary>
        /// 是否拍照定位
        /// </summary>
        public bool IsPhoto
        {
            get => _IsPhoto;
            set
            {
                Set(ref _IsPhoto, value);
            }
        }
        private bool _IsPhoto;


        /// <summary>
        /// CAD文件名称
        /// </summary>
        public string? CADName
        {
            get => _CADName;
            set
            {
                Set(ref _CADName, value);
            }
        }
        private string? _CADName;


        /// <summary>
        /// X轴拍照位置
        /// </summary>
        public double XAxisPhotoPos
        {
            get => _XAxisPhotoPos;
            set
            {
                Set(ref _XAxisPhotoPos, value);

            }
        }
        private double _XAxisPhotoPos;


        /// <summary>
        /// Y轴拍照位置
        /// </summary>
        public double YAxisPhotoPos
        {
            get => _YAxisPhotoPos;
            set
            {
                Set(ref _YAxisPhotoPos, value);

            }
        }
        private double _YAxisPhotoPos;

        /// <summary>
        /// 单次切割产品数量
        /// </summary>
        public uint CuttingProductNumberOneTime
        {
            get => _CuttingProductNumberOneTime;
            set
            {
                Set(ref _CuttingProductNumberOneTime, value);

            }
        }
        private uint _CuttingProductNumberOneTime;




        /// <summary>
        /// 单次下料吸取产品数量
        /// </summary>
        public uint  UnloadProductNumberOneTime
        {
            get => _UnloadProductNumberOneTime;
            set
            {
                Set(ref _UnloadProductNumberOneTime, value);

            }
        }
        private uint _UnloadProductNumberOneTime;

        /// <summary>
        /// X轴下料起始坐标
        /// </summary>
        public double XAxisUnloadStartPos
        {
            get => _XAxisUnloadStartPos;
            set
            {
                Set(ref _XAxisUnloadStartPos, value);

            }
        }
        private double _XAxisUnloadStartPos;


        /// <summary>
        /// Y轴下料起始坐标
        /// </summary>
        public double YAxisUnloadStartPos
        {
            get => _YAxisUnloadStartPos;
            set
            {
                Set(ref _YAxisUnloadStartPos, value);

            }
        }
        private double _YAxisUnloadStartPos;


        /// <summary>
        /// Z轴下料起始坐标
        /// </summary>
        public double ZAxisUnloadStartPos
        {
            get => _ZAxisUnloadStartPos;
            set
            {
                Set(ref _ZAxisUnloadStartPos, value);

            }
        }
        private double _ZAxisUnloadStartPos;


        /// <summary>
        /// 冲孔点X轴偏移值
        /// </summary>
        public double PunchXOffset
        {
            get => _PunchXOffset;
            set
            {
                Set(ref _PunchXOffset, value);

            }
        }

        private double _PunchXOffset;


        /// <summary>
        /// 冲孔点Y轴偏移值
        /// </summary>
        public double PunchYOffset
        {
            get => _PunchYOffset;
            set
            {
                Set(ref _PunchYOffset, value);

            }
        }

        private double _PunchYOffset =  -87;


        /// <summary>
        /// 开始切割X轴位置
        /// </summary>
        public double StartCuttingXPos
        {
            get => _StartCuttingXPos;
            set
            {
                Set(ref _StartCuttingXPos, value);

            }
        }

        private double _StartCuttingXPos;



        /// <summary>
        /// 开始切割Y轴位置
        /// </summary>
        public double StartCuttingYPos
        {
            get => _StartCuttingYPos;
            set
            {
                Set(ref _StartCuttingYPos, value);

            }
        }

        private double _StartCuttingYPos;

        /// <summary>
        /// 开始切割Z轴位置
        /// </summary>
        public double StartCuttingZPos
        {
            get => _StartCuttingZPos;
            set
            {
                Set(ref _StartCuttingZPos, value);

            }
        }

        private double _StartCuttingZPos;





        /// <summary>
        /// 切断点X轴位置
        /// </summary>
        public double CutOffXPos
        {
            get => _CutOffXPos;
            set
            {
                Set(ref _CutOffXPos, value);

            }
        }

        private double _CutOffXPos;



        /// <summary>
        /// 切断点Y轴位置
        /// </summary>
        public double CutOffYPos
        {
            get => _CutOffYPos;
            set
            {
                Set(ref _CutOffYPos, value);

            }
        }

        private double _CutOffYPos;



        /// <summary>
        /// 切断点Z轴位置
        /// </summary>
        public double CutOffZPos
        {
            get => _CutOffZPos;
            set
            {
                Set(ref _CutOffZPos, value);

            }
        }

        private double _CutOffZPos;



        /// <summary>
        /// 上料点X轴位置
        /// </summary>
        public double LoadXPos
        {
            get => _LoadXPos;
            set
            {
                Set(ref _LoadXPos, value);

            }
        }

        private double _LoadXPos;



        /// <summary>
        /// 上料点Y轴位置
        /// </summary>
        public double LoadYPos
        {
            get => _LoadYPos;
            set
            {
                Set(ref _LoadYPos, value);

            }
        }

        private double _LoadYPos;



        /// <summary>
        /// 上料点Z轴位置
        /// </summary>
        public double LoadZPos
        {
            get => _CutOffZPos;
            set
            {
                Set(ref _LoadZPos, value);

            }
        }

        private double _LoadZPos;



        /// <summary>
        /// 切断点结束Y轴位置
        /// </summary>
        public double CutOffEndYPos
        {
            get => _CutOffEndYPos;
            set
            {
                Set(ref _CutOffEndYPos, value);

            }
        }

        private double _CutOffEndYPos;


        /// <summary>
        /// 夹子放开点
        /// </summary>
        public double ReleaseClampXPos
        {
            get => _ReleaseClampXPos;
            set
            {
                Set(ref _ReleaseClampXPos, value);

            }
        }

        private double _ReleaseClampXPos;

        /// <summary>
        /// 回收夹料点
        /// </summary>
        public double CollectClampXPos
        {
            get => _CollectClampXPos;
            set
            {
                Set(ref _CollectClampXPos, value);

            }
        }

        private double _CollectClampXPos;




        /// <summary>
        /// 回收放料点
        /// </summary>
        public double CollectReleaseXPos
        {
            get => _CollectReleaseXPos;
            set
            {
                Set(ref _CollectReleaseXPos, value);

            }
        }

        private double _CollectReleaseXPos;





        /// <summary>
        /// 冲孔点Z轴偏移值
        /// </summary>
        public double PunchZOffset
        {
            get => _PunchZOffset;
            set
            {
                Set(ref _PunchZOffset, value);

            }
        }

        private double _PunchZOffset;

        /// <summary>
        /// 切割刀X轴偏移值
        /// </summary>
        public double KnifeXOffset
        {
            get => _KnifeXOffset;
            set
            {
                Set(ref _KnifeXOffset, value);

            }
        }

        private double _KnifeXOffset = -23;


        /// <summary>
        /// 切割到Y轴偏移值
        /// </summary>
        public double KnifeYOffset
        {
            get => _KnifeYOffset;
            set
            {
                Set(ref _KnifeYOffset, value);

            }
        }

        private double _KnifeYOffset= -264;


        /// <summary>
        /// 切割到Z轴偏移值
        /// </summary>
        public double KnifeZOffset
        {
            get => _KnifeZOffset;
            set
            {
                Set(ref _KnifeZOffset, value);

            }
        }

        private double _KnifeZOffset;



        /// <summary>
        /// 刀具补偿
        /// </summary>
        public double KnifeCompensate
        {
            get => _KnifeCompensate;
            set
            {
                Set(ref _KnifeCompensate, value);

            }
        }

        private double _KnifeCompensate = 1.5;


        /// <summary>
        /// X轴第一张补偿
        /// </summary>
        public double XAxisFirstCompensate
        {
            get => _XAxisFirstCompensate;
            set
            {
                Set(ref _XAxisFirstCompensate, value);

            }
        }

        private double _XAxisFirstCompensate = 0;


        /// <summary>
        /// 下料最大数量
        /// </summary>
        public int UnloadMaxNumber
        {
            get => _UnloadMaxNumber;
            set
            {
                if ((value * Thickness)/UnloadProductNumberOneTime > 450)
                {
                    MessageBox.Show("码垛已超过最大数量值!");
                    return;
                }
                Set(ref _UnloadMaxNumber, value);
            }
        }

        private int _UnloadMaxNumber;


        public bool IsLastSelected
        {
            get => _IsLastSelected;
            set
            {
                Set(ref _IsLastSelected, value);
            }
        }
        private bool _IsLastSelected = false;

    }
}
